//
//  ST_PecSquareNormalLeftCell.swift
//  btvideo
//
//  Created by mac on 2020/1/14.
//  Copyright © 2020 JarvanZhang. All rights reserved.
//

import UIKit
import SwifterSwift

class ST_PecSquareNormalLeftCell: UICollectionViewCell {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        contentView.addSubview(cover_image_view)
        cover_image_view.snp.makeConstraints { (make) in
            make.edges.equalToSuperview().inset(UIEdgeInsets.init(top: 0, left: 15, bottom: 15, right: 8))
        }
        contentView.addSubview(coverView)
        coverView.snp.makeConstraints { (make) in
            make.edges.equalTo(cover_image_view)
        }
        contentView.addSubview(content_label)
        content_label.snp.makeConstraints { (make) in
            make.center.equalToSuperview()
        }
        
//        contentView.backgroundColor = Color.random
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    

    fileprivate lazy var cover_image_view:UIImageView = {
        let control = UIImageView()
        control.contentMode = UIView.ContentMode.scaleAspectFill
        control.cornerRadius = 20
        return control
    }()
    
    fileprivate lazy var coverView:UIView = {
        let control = UIView()
        control.backgroundColor = Color.init(white: 0, alpha: 0.3)
        control.cornerRadius = 20
        return control
    }()

    fileprivate lazy var content_label:UILabel = {
        let control = UILabel.init()
        control.text = ""
        control.textColor = Color.white
//        control.numberOfLines = 0
//        control.textAlignment = .center
        control.font = UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.semibold)
        return control
    }()
    
    var model = ST_PeculiaritySquareNormalCellModel(){
        didSet{
            
            
            cover_image_view.pin_setImage(from: model.pec.image.compress_image().url, placeholderImage: ST_SwiftConst.shared.fetch_random_place_holder_image())
            
            content_label.text = model.pec.name
        }
    }
    
}







class ST_PecSquareNormalRightCell: UICollectionViewCell {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        contentView.backgroundColor = .white
        
        contentView.addSubview(cover_image_view)
        cover_image_view.snp.makeConstraints { (make) in
            make.edges.equalToSuperview().inset(UIEdgeInsets.init(top: 0, left: 8, bottom: 15, right: 15))
        }
        contentView.addSubview(coverView)
        coverView.snp.makeConstraints { (make) in
            make.edges.equalTo(cover_image_view)
        }
        contentView.addSubview(content_label)
        content_label.snp.makeConstraints { (make) in
            make.center.equalToSuperview()
        }
        
//        contentView.backgroundColor = Color.random
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    

    fileprivate lazy var cover_image_view:UIImageView = {
        let control = UIImageView()
        control.contentMode = UIView.ContentMode.scaleAspectFill
        control.cornerRadius = 20
        return control
    }()
    
    fileprivate lazy var coverView:UIView = {
        let control = UIView()
        control.backgroundColor = Color.init(white: 0, alpha: 0.3)
        control.cornerRadius = 20
        return control
    }()

    fileprivate lazy var content_label:UILabel = {
        let control = UILabel.init()
        control.text = ""
        control.textColor = Color.white
//        control.numberOfLines = 0
//        control.textAlignment = .center
        control.font = UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.semibold)
        return control
    }()
    
    var model = ST_PeculiaritySquareNormalCellModel(){
        didSet{
            
            
            cover_image_view.pin_setImage(from: model.pec.image.compress_image().url, placeholderImage: ST_SwiftConst.shared.fetch_random_place_holder_image())
            
            content_label.text = model.pec.name
        }
    }
    
}
